package com.xmu.prcs.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Index;
/**
 * 回复表
 * @author frequent
 *
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "reply")
@org.hibernate.annotations.Table(appliesTo = "reply",
        indexes = {@Index(name = "idxRRT", columnNames = {"replytime"})})
public class Reply implements Serializable {

	private Integer idReply;
	private String content;//回复内容
	private Date replyTime;//回复时间
	private User auther;//作者
	private Integer replyTo;//引用的回复
	
	public Reply(){
		
	}
	
	public Reply(String content, Date replyTime){
		this.content = content;
		this.replyTime = replyTime;
	}

	@Id
	@GeneratedValue
	@Column(name = "idreply", unique = true, nullable = true)
	public Integer getIdReply() {
		return idReply;
	}

	public void setIdReply(Integer idReply) {
		this.idReply = idReply;
	}

	@Column(name = "content", length = 1000)
	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@Column(name = "replytime")
	public Date getReplyTime() {
		return replyTime;
	}

	public void setReplyTime(Date replyTime) {
		this.replyTime = replyTime;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "idauther", nullable = true)
	public User getAuther() {
		return auther;
	}

	public void setAuther(User auther) {
		this.auther = auther;
	}

	@Column(name = "replyto")
	public Integer getReplyTo() {
		return replyTo;
	}

	public void setReplyTo(Integer replyTo) {
		this.replyTo = replyTo;
	}

	
}
